package com.erdos.event.message;


public class MessageEvent {
	private MessageEventType eventType;
	private Object message;
	private MessageFilterChain filterChain;
	
	public MessageEvent(MessageFilterChain filterChain, MessageEventType eventType, Object message) {
		this.filterChain=filterChain;
		this.eventType=eventType;
		this.message=message;	
	}
	
	public void fire() {
		switch(this.eventType) {
		case BEFORE_SENDING:
			filterChain.doFilter(this.message, null);
			break;
			//...
		default:
			throw new IllegalArgumentException("Unknown event type: " +this.eventType);
		}
	}
}
